<?php
// ========================== 文件说明 ==========================//
// 本文件说明：前台主程序
// --------------------------------------------------------------//
// 本程序作者：angel
// --------------------------------------------------------------//
// 本程序版本：SaBlog-X Ver 1.6
// --------------------------------------------------------------//
// 本程序主页：http://www.sablog.net
// ========================== 开发环境 ==========================//
// register_globals = Off
// --------------------------------------------------------------//
// magic_quotes_gpc = On
// --------------------------------------------------------------//
// safe_mode = On
// --------------------------------------------------------------//
// Windows server 2003 & Linux & FreeBSD
// --------------------------------------------------------------//
// Apache/1.3.33 & PHP/4.3.2 & MySQL/4.0.17
// --------------------------------------------------------------//
// Apache/1.3.34 & PHP/4.4.1 & MySQL/5.0.16
// --------------------------------------------------------------//
// Apache/2.0.55 & PHP/5.1.1 & MySQL/5.0.15
// --------------------------------------------------------------//
// Copyright (C) Security Angel Team All Rights Reserved.
// ==============================================================//

require_once('global.php');
//require_once(SABLOG_ROOT.'include/query.inc.php');

!$action  && $action = 'article';
/*
//清除浏览商品记录
if ($_GET['action'] == 'clearalready') {
	if(is_array($_COOKIE['articleids'])){
		foreach($_COOKIE['articleids'] as $key => $value){
			scookie("articleids[".$key."]", '');
		}
	}
	$url_forward = $_SERVER['HTTP_REFERER'];
	message('已经删除浏览过的商品记录', $url_forward);
}
*/

$maxpages = 1000;
$page = $maxpages && $page > $maxpages ? 1 : $page;

$moduledb = array(
	'article',
	'search',
	'show',
	'tagslist',
	'comments',
	'trackbacks',
	'archives',
	'links',
	'files',
	'practiselib',
	'caselib',
	'actreg',
	'reg',
	'live',
	'16',
);

if (in_array($action, $moduledb)) {
	$module = loadmodule($action);
} else {
	message('未知模块');
}


!$options['meta_description'] && $options['meta_description'] = $options['description'];
if (!$options['meta_keywords']) {
	$tmp = $comma = '';
	if (is_array($catecache) && count($catecache)){
		foreach($catecache as $data) {
			$tmp .= $comma.$data['name'];
			$comma = ',';
		}
		$options['meta_keywords'] = $tmp;
	}
}

include $module;

include template($pagefile);

updatesession();
footer();

?>